package com.nchu.student_score.controller;

import com.github.pagehelper.PageInfo;
import com.nchu.student_score.model.Profession;
import com.nchu.student_score.service.ProfessionService;
import com.nchu.student_score.vo.ResultVo;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/profession")
public class ProfessionController {
    @Resource
    ProfessionService professionService;

    @RequestMapping("getProfessionList/{currPage}")
    public PageInfo<Profession> getProfessionList(@RequestBody Profession profession, @PathVariable Integer currPage){
        return professionService.getProfessionList(profession,currPage);
    }

    @RequestMapping("insertOne")
    public ResultVo<Profession> insertOne(@RequestBody Profession profession){
        return professionService.insertOne(profession);
    }

    @RequestMapping("updateOne")
    public ResultVo<Profession> updateOne(@RequestBody Profession profession){
        return professionService.updateOne(profession);
    }

    @RequestMapping("getProfession/{academyId}")
    public ResultVo<Profession> getProfession(@PathVariable Integer academyId){
        return professionService.getProfession(academyId);
    }
}
